package com.suredy.tools;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

/**
 * 树模型
 * 
 * @author VIVID.G
 * @since 2015-4-23
 * @version v0.1
 */
@JsonInclude(Include.NON_EMPTY)
public class SuredyTreeModel implements Serializable {

	private static final long serialVersionUID = 9097190041876431406L;

	/* 树节点id */
	private String id;
	/* 节点文本 */
	private String text;
	/* 默认折叠 */
	private boolean collapse = true;
	/* 是否为叶子 */
	private boolean leaf = true;
	/* 子节点 */
	private List<SuredyTreeModel> children;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public boolean isCollapse() {
		return collapse;
	}

	public void setCollapse(boolean collapse) {
		this.collapse = collapse;
	}

	public boolean isLeaf() {
		return leaf;
	}

	public void setLeaf(boolean leaf) {
		this.leaf = leaf;
	}

	public List<SuredyTreeModel> getChildren() {
		return children;
	}

	public void setChildren(List<SuredyTreeModel> children) {
		this.children = children;

		if (this.children != null)
			this.setLeaf(false);
	}

}
